/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jaiz.app.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author chuy
 */
@Entity
@Table(name = "place", catalog = "chiwasmaps", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Place.findAll", query = "SELECT p FROM Place p"),
    @NamedQuery(name = "Place.findByPlaceId", query = "SELECT p FROM Place p WHERE p.placeId = :placeId"),
    @NamedQuery(name = "Place.findByName", query = "SELECT p FROM Place p WHERE p.name = :name"),
    @NamedQuery(name = "Place.findByDescription", query = "SELECT p FROM Place p WHERE p.description = :description"),
    @NamedQuery(name = "Place.findByLat", query = "SELECT p FROM Place p WHERE p.lat = :lat"),
    @NamedQuery(name = "Place.findByLng", query = "SELECT p FROM Place p WHERE p.lng = :lng"),
    @NamedQuery(name = "Place.findByType", query = "SELECT p FROM Place p WHERE p.type = :type"),
    @NamedQuery(name = "Place.findByAddress", query = "SELECT p FROM Place p WHERE p.address = :address"),
    @NamedQuery(name = "Place.findByNeighborhood", query = "SELECT p FROM Place p WHERE p.neighborhood = :neighborhood"),
    @NamedQuery(name = "Place.findByCreateDate", query = "SELECT p FROM Place p WHERE p.createDate = :createDate"),
    @NamedQuery(name = "Place.findByUpdateDate", query = "SELECT p FROM Place p WHERE p.updateDate = :updateDate"),
    @NamedQuery(name = "Place.findByCityId", query = "SELECT p FROM Place p WHERE p.cityId = :cityId")})
public class Place implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "place_id", nullable = false)
    private Integer placeId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "name", nullable = false, length = 45)
    private String name;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "description", nullable = false, length = 45)
    private String description;
    @Basic(optional = false)
    @NotNull
    @Column(name = "lat", nullable = false)
    private double lat;
    @Basic(optional = false)
    @NotNull
    @Column(name = "lng", nullable = false)
    private double lng;
    @Basic(optional = false)
    @NotNull
    @Column(name = "type", nullable = false)
    private int type;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 105)
    @Column(name = "address", nullable = false, length = 105)
    private String address;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 75)
    @Column(name = "neighborhood", nullable = false, length = 75)
    private String neighborhood;
    @Basic(optional = false)
    @NotNull
    @Column(name = "create_date", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date createDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "update_date", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date updateDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "city_id", nullable = false)
    private int cityId;

    public Place() {
    }

    public Place(Integer placeId) {
        this.placeId = placeId;
    }

    public Place(Integer placeId, String name, String description, double lat, double lng, int type, String address, String neighborhood, Date createDate, Date updateDate, int cityId) {
        this.placeId = placeId;
        this.name = name;
        this.description = description;
        this.lat = lat;
        this.lng = lng;
        this.type = type;
        this.address = address;
        this.neighborhood = neighborhood;
        this.createDate = createDate;
        this.updateDate = updateDate;
        this.cityId = cityId;
    }

    public Integer getPlaceId() {
        return placeId;
    }

    public void setPlaceId(Integer placeId) {
        this.placeId = placeId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public double getLat() {
        return lat;
    }

    public void setLat(double lat) {
        this.lat = lat;
    }

    public double getLng() {
        return lng;
    }

    public void setLng(double lng) {
        this.lng = lng;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getNeighborhood() {
        return neighborhood;
    }

    public void setNeighborhood(String neighborhood) {
        this.neighborhood = neighborhood;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public int getCityId() {
        return cityId;
    }

    public void setCityId(int cityId) {
        this.cityId = cityId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (placeId != null ? placeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Place)) {
            return false;
        }
        Place other = (Place) object;
        if ((this.placeId == null && other.placeId != null) || (this.placeId != null && !this.placeId.equals(other.placeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jaiz.app.model.Place[ placeId=" + placeId + " ]";
    }
    
}
